<?php

use Illuminate\Http\Request;

Route::namespace('Wx')->group(function(){
	
	// get-openid
	Route::post('get-openid','IndexController@getOpenid');

	// get-wx-user
	Route::post('get-wx-user','IndexController@getWxUser');	

	// 获取token
	Route::post('get-token','IndexController@getToken');

	Route::post('notice',    'IndexController@notice');

	
	Route::post('upload',	'IndexController@upload');

	// 首页推荐的商品
	Route::post('rec-product','IndexController@recProduct');

	// 首页往期商品
	Route::post('old-product','IndexController@oldProduct');

	// 首页推荐的分类
	Route::post('rec-cate',   'IndexController@recCate');

	Route::post('banner',	  'IndexController@banner');

	// 支付回调
	Route::any('pay-notify', 'PayController@payNotify');

	// 获取小程序码
	Route::any('get-smallcode','IndexController@getSmallcode');

	// 代金券
	Route::post('coupon','IndexController@coupon');

	Route::prefix('product')->group(function(){
		Route::post('list',		'ProductController@index');
		Route::post('info',		'ProductController@info');
		Route::post('cate',		'ProductController@cate');
		Route::post('search',	'ProductController@search');
		Route::post('order-log','ProductController@orderLog');
	});

	Route::prefix('cart')->group(function(){
            Route::post('add',     'CartController@add');
            Route::post('list',    'CartController@index');
            Route::post('del',     'CartController@del');
            Route::post('increase','CartController@increase');
            Route::post('decrease','CartController@decrease');
            Route::post('del-all', 'CartController@delAll');
        });

        Route::prefix('order')->group(function(){
            Route::post('add',     'OrderController@add');
            Route::post('info',    'OrderController@info');
            Route::post('list',    'OrderController@index');
            Route::any('complete', 'OrderController@complete');
            Route::post('repeat',  'OrderController@repeat');
            Route::post('confirm-complete','OrderController@confirmComplete');
        });
	
    // 用户
	Route::prefix('user')->group(function(){
		Route::post('info',  'UserController@info');
		Route::post('update','UserController@update');
		Route::prefix('address')->group(function(){
			Route::post('index','UserAddressController@index');
			Route::post('info', 'UserAddressController@info');
			Route::post('add',  'UserAddressController@store');
			Route::post('update',    'UserAddressController@update');
			Route::post('del',       'UserAddressController@delete');
			Route::post('setdefault','UserAddressController@setdefault');
		});

		Route::prefix('coupon')->group(function(){
			Route::post('index'	,	'UserCouponController@index');
			Route::post('add'	,	'UserCouponController@store');
		});
	});    
	

});


